//
//  AppController.h
//  MacHeliosSim
//
//  Created by Paul Thompson on 8/12/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import "NuclideTable.h"
#import "Nuclide.h"
#import "Reaction.h"
#import "KinematicsCalculator.h"
#import "KinCalcReturnData.h"
#import <CorePlot/CorePlot.h>
#import "HeliosRoughSim.h"
#import "RoughSimReturnData.h"
#import "Constants.h"

@interface AppController : NSObject {
	
	
	IBOutlet NSTextField *beamEnergyField, *beamMassField, *beamSymbolField, *targetMassField,
	*targetSymbolField,*ejectileMassField, *ejectileSymbolField,
	*productMassField, *productSymbolField, *reactionField, *qValueLabel, *fieldStrengthField, *buildNumber;

	IBOutlet NSTextView *fileContentsTempDisplay;
	IBOutlet NSTextView *logView;
	IBOutlet NSTextContainer *logContainer;
	IBOutlet NSScrollView *myScrollView;
	
	NSString *dataFilePath, *dataFileContents;
	NuclideTable *nuclideData;
	Nuclide *beamNuclide, *targetNuclide, *ejectileNuclide, *productNuclide;
	Reaction *myLittleReaction;
	NSMutableArray *simOutputProduct, *simOutputEjectile,
					*kinOutputProduct, *kinOutputEjectile;
	NSArrayController *kinController, *simController;

	
	NSFont *font;
	NSFont *superScriptFont;
	NSCharacterSet *whitespace;
	NSMutableAttributedString *reactionAttributedString;
	NSMutableParagraphStyle *reactionFieldStyle;
	
	KinematicsCalculator *theKinalculator;
	
	// Graph stuff
	IBOutlet CPLayerHostingView *hostView;
	IBOutlet CPLayerHostingView *hostView2;
	CPXYGraph *kinematicsGraph, *simGraph;
	CGFloat xShiftKin;
	CGFloat yShiftKin;
	CGFloat labelRotation;
	CGFloat xShiftSim;
	CGFloat yShiftSim;
	NSString *logString;
	
	CPXYPlotSpace *plotSpaceKin;
	CPXYPlotSpace *plotSpaceSim;
	CPScatterPlot *kinLinePlot;
	CPScatterPlot *simLinePlot;
	
	IBOutlet NSMatrix *kinPlotSwitcher,*kinAxisSwitcher,*simPlotSwitcher,*simAxisSwitcher;
	
	NSMutableArray *productKinData, *ejectileKinData;
	
	HeliosRoughSim *theRoughSimulator;
	
}
@property (readwrite, assign) NSString *logString;
@property (readwrite,copy) NSString *dataFilePath, *dataFileContents;
@property (readwrite,copy) NuclideTable *nuclideData;
@property (readwrite,copy) Nuclide *beamNuclide, *targetNuclide, *ejectileNuclide, *productNuclide;
@property (readwrite,copy) Reaction *myLittleReaction;
@property (readwrite,copy) NSMutableArray *simOutputProduct, *simOutputEjectile,
										  *kinOutputProduct, *kinOutputEjectile;
@property (readwrite,copy) KinematicsCalculator *theKinalculator;
@property CGFloat xShiftKin, yShiftKin,labelRotation,xShiftSim,yShiftSim;
@property (readwrite,copy) NSArrayController *kinController, *simController;

- (IBAction)restoreTable:(id)sender;
- (NSString *)readCSVFromFileAtPath:(NSString *)thePath;
- (NSString *)getPathForFileName:(NSString *)theName AndType:(NSString *)theType;
- (IBAction)processReaction:(id)sender;
- (IBAction)processKinematics:(id)sender;
- (IBAction)runHELIOSRoughSim:(id)sender;
- (IBAction)runHELIOSFullSim:(id)sender;
- (NSMutableAttributedString *)generateFormattedReactionString;
- (IBAction)generateGraphs:(id)sender;
- (void)updatePlotSpace:(CPPlotSpace *)thePlotSpace ForPlot:(CPPlot *)thePlot;
- (IBAction)switchKinAxes:(id)sender;
- (IBAction)switchKinPlots:(id)sender;
- (IBAction)switchSimAxes:(id)sender;
- (IBAction)switchSimPlots:(id)sender;
- (void)setUpGraph:(CPGraph *)theGraph;


@end
